/*
EmailController
Version 1.0
Description: Controller class for VF Page Email, class contains method which prepares and sends email.
Author: Pratibh Prakash
Created Date: 16 Mar-2009
*/
public class EmailController {
	
	private String serverurl;
	public EmailController(ApexPages.StandardController controller){
	
	}
	
	public String getShow(){
		return serverurl;
	}
	public PageReference send(){
		
		Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
		String[] toAddresses = new String[] {'pratibh_prakash@yahoo.com'};
		serverurl = ApexPages.currentPage().getUrl();		
		StaticResource[] st = [select Body from StaticResource];
		Blob att = st[0].Body;
		Messaging.EmailFileAttachment fileAttachment = new  Messaging.EmailFileAttachment();
		fileAttachment.setFileName('UT.jpg');
		fileAttachment.setBody(att);
		Messaging.EmailFileAttachment[] fileAttachments = new  Messaging.EmailFileAttachment[1];
		fileAttachments[0] = fileAttachment;
		mail.setFileAttachments(fileAttachments);
		System.debug('+aaaa++++'+att.toString()+'+++++++++++');
		mail.setToAddresses(toAddresses);
		mail.setSubject('Testing Mail Code: Successful');
		mail.setBccSender(false);
		//mail.setPlainTextBody('FINAAAAAAAAAAAAAAAALLLLLLLL TESTTTTTTTTTTTTTT SUUUUUUUUUCCCCCCCCCCCCCCCCCeeeesssssssssss\n\n\n\n\n');
		mail.setHtmlBody('<img height="200"  width="200" src="https://na6.salesforce.com/servlet/servlet.ImageServer?id=01580000000UMnX&oid=00D80000000LomG&lastMod=1228903388000" /><br>FINAAAAAAAAAAAAAAAALLLLLLLL TESTTTTTTTTTTTTTT SUUUUUUUUUCCCCCCCCCCCCCCCCCeeeesssssssssss');
		Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
		return null;
	}

}